<template>
  <div class="scoring-skeleton">
    <!-- 模拟结果展示的骨架屏 -->
    <div class="skeleton-header">
      <el-skeleton-item variant="text" style="width: 120px; height: 24px;" />
    </div>

    <div class="skeleton-content">
      <!-- 模拟评分值 -->
      <div class="skeleton-item">
        <el-skeleton-item variant="text" style="width: 80px; height: 20px;" />
        <div class="skeleton-value">
          <el-skeleton-item variant="rect" style="width: 100px; height: 36px; border-radius: 8px;" />
        </div>
      </div>

      <!-- 模拟严重程度 -->
      <div class="skeleton-item">
        <el-skeleton-item variant="text" style="width: 80px; height: 20px;" />
        <div class="skeleton-value">
          <el-skeleton-item variant="rect" style="width: 100px; height: 36px; border-radius: 8px;" />
        </div>
      </div>

      <!-- 模拟置信度 -->
      <div class="skeleton-item">
        <el-skeleton-item variant="text" style="width: 80px; height: 20px;" />
        <div class="skeleton-value">
          <el-skeleton-item variant="rect" style="width: 100%; height: 8px; border-radius: 4px;" />
        </div>
      </div>

      <!-- 模拟AI分析 -->
      <div class="skeleton-item">
        <el-skeleton-item variant="text" style="width: 80px; height: 20px;" />
        <div class="skeleton-value">
          <el-skeleton-item variant="text" style="width: 100%; height: 60px;" />
        </div>
      </div>

      <!-- 模拟模型版本 -->
      <div class="skeleton-item">
        <el-skeleton-item variant="text" style="width: 80px; height: 20px;" />
        <div class="skeleton-value">
          <el-skeleton-item variant="rect" style="width: 120px; height: 28px; border-radius: 14px;" />
        </div>
      </div>
    </div>

    <!-- 模拟操作按钮 -->
    <div class="skeleton-actions">
      <el-skeleton-item variant="rect" style="width: 120px; height: 40px; border-radius: 20px;" />
    </div>

    <!-- AI分析提示 -->
    <div class="ai-analyzing-hint">
      <div class="hint-content">
        <el-icon class="analyzing-icon"><Loading /></el-icon>
        <div class="hint-text">
          <h4>AI 正在分析中...</h4>
          <p>智能分析需要几秒钟时间，请耐心等待</p>
        </div>
      </div>
      <div class="pulse-dots">
        <div class="dot"></div>
        <div class="dot"></div>
        <div class="dot"></div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { Loading } from '@element-plus/icons-vue'
</script>

<style scoped>
/* ===== Aperture Scoring Skeleton ===== */
.scoring-skeleton {
  padding: var(--aperture-space-6);
  min-height: 400px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  animation: fadeInUp var(--aperture-duration-normal) var(--aperture-ease-out);
}

.skeleton-header {
  margin-bottom: var(--aperture-space-6);
}

.skeleton-content {
  flex: 1;
  margin-bottom: var(--aperture-space-6);
}

.skeleton-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--aperture-space-5);
  padding: var(--aperture-space-3) 0;
  border-bottom: 1px solid var(--aperture-border-light);
}

.skeleton-item:last-child {
  border-bottom: none;
}

.skeleton-value {
  flex: 1;
  margin-left: var(--aperture-space-4);
  display: flex;
  justify-content: flex-end;
}

.skeleton-actions {
  display: flex;
  justify-content: center;
  margin-top: var(--aperture-space-4);
}

/* ===== AI分析提示 ===== */
.ai-analyzing-hint {
  background: linear-gradient(135deg, var(--aperture-primary-light) 0%, rgba(0, 122, 255, 0.05) 100%);
  border: 1px solid var(--aperture-primary);
  border-radius: var(--aperture-radius-lg);
  padding: var(--aperture-space-5);
  margin-top: var(--aperture-space-6);
  position: relative;
  overflow: hidden;
}

.ai-analyzing-hint::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.hint-content {
  display: flex;
  align-items: center;
  gap: var(--aperture-space-4);
}

.analyzing-icon {
  font-size: 32px;
  color: var(--aperture-primary);
  animation: aperture-spin 2s linear infinite;
}

@keyframes aperture-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.hint-text h4 {
  font-size: var(--aperture-text-lg);
  font-weight: var(--aperture-font-semibold);
  color: var(--aperture-primary);
  margin: 0 0 var(--aperture-space-1) 0;
}

.hint-text p {
  font-size: var(--aperture-text-sm);
  color: var(--aperture-text-secondary);
  margin: 0;
  line-height: var(--aperture-leading-normal);
}

.pulse-dots {
  display: flex;
  justify-content: center;
  gap: var(--aperture-space-2);
  margin-top: var(--aperture-space-4);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--aperture-primary);
  animation: pulse 1.5s ease-in-out infinite;
}

.dot:nth-child(1) { animation-delay: 0s; }
.dot:nth-child(2) { animation-delay: 0.5s; }
.dot:nth-child(3) { animation-delay: 1s; }

@keyframes pulse {
  0%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* ===== Element Plus 骨架屏自定义 ===== */
:deep(.el-skeleton__item) {
  background: linear-gradient(90deg, var(--aperture-bg-tertiary) 25%, var(--aperture-border-light) 50%, var(--aperture-bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .scoring-skeleton {
    padding: var(--aperture-space-4);
    min-height: 300px;
  }

  .skeleton-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--aperture-space-2);
  }

  .skeleton-value {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }

  .hint-content {
    flex-direction: column;
    text-align: center;
  }

  .ai-analyzing-hint {
    padding: var(--aperture-space-4);
  }
}

/* 动画 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
</style>